from enum import Enum


class ExpressBrand(Enum):
    SF = ("SF", "顺丰速运")
    ZTO = ("ZTO", "中通快递")
    YTO = ("YTO", "圆通速递")
    STO = ("STO", "申通快递")
    YD = ("YD", "韵达")
    EMS = ("EMS", "EMS")
    JD = ("JD", "京东")
    DBL = ("DBL", "德邦快递")
    JT = ("JT", "极兔速递")

    def __init__(self, code, desc):
        self._code = code
        self._desc = desc

    def __str__(self):
        return f"{self.code}: {self.desc}: {self.name}"

    @property
    def code(self):
        return self._code

    @property
    def desc(self):
        return self._desc

    @classmethod
    def from_code(cls, code):
        for item in cls:
            if item.code == code:
                return item
        return None


if __name__ == "__main__":
    print(ExpressBrand.ZTO)
    brand = ExpressBrand.from_code("SF")
    print(brand)
